* Time dependent censoring - patient sex.sps.
* Written by PSKL on 1/4/03.

Match files file='D:\Longitudinal Data\Claims Master 1991 to 2001.sav'
  /table = 'D:\Longitudinal Data\Patient Master 1991 to 2001.sav'
  /by patidn.


* Create year/month variable and schednum to number of months.
* Then calculate observation interval in months to next schednum if revisit or 10203 if not.

Compute lstmsn=(lastyear-1900)*100 + lastmont.
Compute schedym=trunc(schednum/100)*12 + schednum - 100*trunc(schednum/100).
Compute lastym = (lastyear-1900)*12 + lastmont.


sort cases by patidn (a) schednum lastym (d).

compute revisit = 0.
if (patidn=lag(patidn)) revisit = 1.

compute  interval = 12*102+3 - lastym.
if (patidn=lag(patidn))interval = lag(schedym) - lastym.

formats patidn claimidn (F10) lstmsn interval (F6) revisit (F1).

save outfile='d:\temp1.sav'
/keep patidn claimidn lstmsn schednum interval revisit patsex.
get file='d:\temp1.sav'.

CROSSTABS
  /TABLES=interval  BY revisit By patsex
  /FORMAT= AVALUE TABLES
  /CELLS= COUNT .

Crosstabs

Notes
Output Created 01-APR-2003 16:30:06
Comments
Input Data d:\temp1.sav
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 732386
Missing Value Handling Definition of Missing User-defined missing values are treated as missing.
Cases Used Statistics for each table are based on all the cases with valid data in the specified range(s) for all variables in each table.
Syntax CROSSTABS
/TABLES=interval BY revisit By patsex
/FORMAT= AVALUE TABLES
/CELLS= COUNT .
Resources Dimensions Requested 3
Cells Available 95325
Elapsed Time 0:00:06.46

Case Processing Summary

Cases
Valid Missing Total
N Percent N Percent N Percent
INTERVAL * REVISIT * PATSEX 732386 100.0% 0 .0% 732386 100.0%


INTERVAL * REVISIT * PATSEX Crosstabulation
Count

REVISIT Total
PATSEX 0 1
F INTERVAL 0 574 671 1245
1 2240 9789 12029
2 2823 20419 23242
3 1981 22995 24976
4 2677 25530 28207
5 2447 22614 25061
6 1943 28522 30465
7 1456 61561 63017
8 1252 47008 48260
9 1015 27683 28698
10 902 18568 19470
11 773 13049 13822
12 698 10153 10851
13 582 8608 9190
14 515 7011 7526
15 364 5780 6144
16 482 4739 5221
17 420 3784 4204
18 360 3183 3543
19 346 2711 3057
20 325 2368 2693
21 369 2014 2383
22 342 1839 2181
23 308 1711 2019
24 334 1543 1877
25 284 1386 1670
26 273 1183 1456
27 231 1080 1311
28 285 1000 1285
29 255 857 1112
30 295 837 1132
31 215 689 904
32 261 660 921
33 253 605 858
34 232 512 744
35 231 504 735
36 268 502 770
37 224 433 657
38 211 427 638
39 195 395 590
40 213 357 570
41 211 327 538
42 230 313 543
43 223 295 518
44 213 276 489
45 228 256 484
46 201 222 423
47 212 223 435
48 257 228 485
49 192 192 384
50 198 208 406
51 176 199 375
52 172 203 375
53 191 189 380
54 185 166 351
55 149 136 285
56 213 134 347
57 192 136 328
58 168 103 271
59 169 119 288
60 197 115 312
61 171 121 292
62 193 131 324
63 147 84 231
64 193 102 295
65 182 94 276
66 155 90 245
67 156 89 245
68 186 78 264
69 166 73 239
70 185 76 261
71 191 81 272
72 166 62 228
73 160 58 218
74 174 59 233
75 144 66 210
76 194 60 254
77 192 75 267
78 165 73 238
79 165 59 224
80 186 48 234
81 207 45 252
82 180 56 236
83 166 35 201
84 175 39 214
85 167 44 211
86 143 41 184
87 145 51 196
88 179 37 216
89 171 21 192
90 166 30 196
91 151 29 180
92 174 26 200
93 181 32 213
94 146 24 170
95 157 25 182
96 172 20 192
97 162 15 177
98 120 17 137
99 111 23 134
100 162 17 179
101 146 19 165
102 136 18 154
103 155 11 166
104 166 14 180
105 161 15 176
106 132 18 150
107 141 13 154
108 161 6 167
109 171 10 181
110 139 4 143
111 108 13 121
112 149 11 160
113 156 4 160
114 157 9 166
115 138 6 144
116 152 5 157
117 160 4 164
118 121 7 128
119 108 3 111
120 130 11 141
121 128 5 133
122 103 3 106
123 111
111
124 127 4 131
125 124 3 127
126 128 3 131
127 108 2 110
128 137 1 138
129 99
99
130 100 3 103
131 111 1 112
132 84
84
133 82
82
134 81
81
Total 44547 371752 416299
M INTERVAL 0 435 446 881
1 1765 6661 8426
2 2216 14475 16691
3 1688 16003 17691
4 2168 17253 19421
5 1960 15272 17232
6 1597 21002 22599
7 1146 47130 48276
8 1004 35262 36266
9 875 20600 21475
10 695 13323 14018
11 584 9292 9876
12 593 7346 7939
13 476 6660 7136
14 478 5369 5847
15 358 4536 4894
16 464 3588 4052
17 385 3023 3408
18 323 2640 2963
19 347 2262 2609
20 336 1940 2276
21 307 1803 2110
22 292 1552 1844
23 236 1445 1681
24 298 1428 1726
25 304 1234 1538
26 260 1130 1390
27 242 971 1213
28 255 839 1094
29 259 764 1023
30 256 669 925
31 215 681 896
32 248 597 845
33 233 557 790
34 192 520 712
35 221 460 681
36 249 470 719
37 199 396 595
38 180 394 574
39 166 419 585
40 202 322 524
41 208 354 562
42 216 307 523
43 191 340 531
44 215 297 512
45 195 298 493
46 164 242 406
47 194 271 465
48 197 236 433
49 180 222 402
50 199 226 425
51 179 212 391
52 188 187 375
53 175 191 366
54 164 202 366
55 149 158 307
56 179 144 323
57 166 138 304
58 149 145 294
59 159 145 304
60 162 136 298
61 169 114 283
62 153 132 285
63 126 130 256
64 144 126 270
65 184 116 300
66 151 100 251
67 161 116 277
68 176 99 275
69 171 102 273
70 148 100 248
71 158 76 234
72 175 86 261
73 158 84 242
74 163 71 234
75 114 61 175
76 150 70 220
77 160 66 226
78 135 65 200
79 147 60 207
80 145 63 208
81 128 61 189
82 143 53 196
83 151 56 207
84 176 44 220
85 138 61 199
86 138 46 184
87 134 33 167
88 121 39 160
89 146 37 183
90 140 33 173
91 125 39 164
92 130 38 168
93 150 30 180
94 116 32 148
95 122 33 155
96 162 30 192
97 126 27 153
98 107 22 129
99 99 25 124
100 161 29 190
101 119 29 148
102 153 18 171
103 126 21 147
104 131 15 146
105 114 15 129
106 139 23 162
107 120 18 138
108 172 11 183
109 141 18 159
110 126 10 136
111 121 15 136
112 148 9 157
113 130 8 138
114 115 11 126
115 113 7 120
116 129 8 137
117 148 5 153
118 95 8 103
119 92 7 99
120 108 15 123
121 103 5 108
122 114 5 119
123 83 3 86
124 106 10 116
125 117
117
126 99 1 100
127 82 1 83
128 93 3 96
129 88 2 90
130 96 4 100
131 82 1 83
132 88
88
133 74 1 75
134 88
88
Total 37990 278097 316087

Aggregate outfile=*
 /break interval revisit patsex
 /n=n.

sort cases by patsex (a) interval revisit (d).
compute cases=n.
if (revisit=0 and lag(patsex)=patsex and lag(interval)=interval) cases=n+lag(n).
execute.
select if revisit=0.
compute reattend=cases-n.

compute cumcases=cases.
compute cumreatt=reattend.

do if ($casenum > 1 and Lag (patsex) = patsex).
compute cumcases=cumcases+lag(cumcases).
compute cumreatt=cumreatt + lag(cumreatt).
end if.

compute prreatt=cumreatt/cumcases.
sort cases by patsex interval.

save outfile='D:\Longitudinal Data\reattendance probability patsex.sav'
  /DROP=revisit n cases reattend cumcases cumreatt /COMPRESSED.

GRAPH
  /LINE(MULTIPLE)MEAN(prreatt) BY interval BY patsex
  /MISSING=REPORT.

Graph

Notes
Output Created 01-APR-2003 16:32:42
Comments
Input File Label Aggregated File
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 270
Syntax GRAPH
/LINE(MULTIPLE)MEAN(prreatt) BY interval BY patsex
/MISSING=REPORT.
Resources Elapsed Time 0:00:00.11

Line of mean(prreatt) by interval patsex